<template>
  <div class="addGood">
    <div class="add-header">
        <h2 :style="index==0?{color:'#1d95ff'}:{color:'#000000'}" @click="choosePanel(0)">基本信息</h2>
        <h2 :style="index==1?{color:'#1d95ff'}:{color:'#000000'}" @click="choosePanel(1)">商品图片</h2>
        <h2 :style="index==2?{color:'#1d95ff'}:{color:'#000000'}" @click="choosePanel(2)">商品描述</h2>
    </div>
    <div class="add-body">
        <router-view></router-view>
    </div>
  </div>
</template>

<script>
export default {
    data(){
        return {
            index:-1
        }
    },
    methods:{
        choosePanel(index){
            if(index==this.index)
                return
            this.index = index
            switch(index){
                case 0:{
                    this.$router.push('/manager/addGood/goodBase')
                    break
                }case 1:{
                    this.$router.push('/manager/addGood/goodImg')
                    break
                }case 2:{
                    this.$router.push('/manager/addGood/goodDesc')
                    break
                }
            }
        }
    },
    mounted(){
        this.choosePanel(0)
    }
}
</script>

<style lang="less">
    .addGood{
        position: relative;
        width: 95%;
        height: 95%;
        border-radius: 15px;
        margin-bottom: 20px;
        box-sizing: border-box;
        padding: 10px;
        .add-header{
            h2{
                margin-left: 20px;
                margin-right: 20px;
                cursor: pointer;
            }
            display: flex;
            margin-bottom: 20px;
        }
        .add-body{
            background-color: #ffffff;
            width: 95%;
            height: 95%;
            box-sizing: border-box;
            padding: 40px 20px;
            border-radius: 15px;
        }
    }
</style>